import request from '@/utils/request'

// 查询公告列表
export function listNotice(query) {
  return request({
    url: '/system/announcement/list',
    method: 'get',
    params: query
  })
}

// 查询公告详细
export function getNotice(noticeId) {
  return request({
    url: '/system/announcement/detail/' + noticeId,
    method: 'get'
  })
}

// 公告上传
export function noticeUpFiles(data) {
  return request({
    url: '/file/minioUpload',
    method: 'post',
    data
  })
}

// 公告附件删除
export function noticeDelFile(params) {
  return request({
    url: '/file/minioDelete',
    method: 'post',
    params
  })
}

// 新增付款计划
export function setNotice(data) {
  return request({
    url: '/system/announcement/save',
    method: 'post',
    data
  })
}

// 下架公告
export function downNotice(noticeId) {
  return request({
    url: '/system/announcement/down/' + noticeId,
    method: 'post'
  })
}
// 标记公告已读
export function readNotice(noticeId) {
  return request({
    url: '/system/announcement/read/' + noticeId,
    method: 'post'
  })
}

// 新增公告
export function addNotice(data) {
  return request({
    url: '/system/notice',
    method: 'post',
    data: data
  })
}

// 修改公告
export function updateNotice(data) {
  return request({
    url: '/system/notice',
    method: 'put',
    data: data
  })
}

// 删除公告
export function delNotice(noticeId) {
  return request({
    url: '/system/announcement/delete/' + noticeId,
    method: 'delete'
  })
}

/**
 * @params 新增消息
 */

export function addManage(data) {
  return request({
    method: 'post',
    url: '/system/message/mid/add',
    data
  })
}

// 查询群组列表
export function listGroup(query) {
  return request({
    url: '/system/announcement/group/list',
    method: 'get',
    params: query
  })
}
// 新增群组
export function saveGroup(data) {
  return request({
    url: '/system/announcement/group/save',
    method: 'post',
    data: data
  })
}
// 删除群组
export function delGroup(data) {
  return request({
    url: '/system/announcement/group/delete',
    method: 'post',
    params: data
  })
}

/**
 * @params 计算工作日
 */
export function getWorkDay(params) {
  return request({
    method: 'get',
    url: '/system/day/calendar/after/get',
    params
  })
}

/**
 * @params 获取最近一条消息
 */

export function getLatestMsg(params) {
  return request({
    method: 'get',
    url: '/system/message/mid/latest/get',
    params
  })
}
